//
//  SPSelectPayTypeView.m
//  panzer
//
//  Created by 还带大道 on 2018/10/21.
//  Copyright © 2018年 还带大道. All rights reserved.
//

#import "SPSelectPayTypeView.h"
#import "SPCommon.h"
#import "SPPayTypeTableViewCell.h"

@interface SPSelectPayTypeView()
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (weak, nonatomic) IBOutlet UIButton *backBtn;

@end

@implementation SPSelectPayTypeView


+ (instancetype)shareHeaderView
{
    return [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil].lastObject;
}


- (void)awakeFromNib
{
    [super awakeFromNib];
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([SPPayTypeTableViewCell class]) bundle:nil]  forCellReuseIdentifier:NSStringFromClass([SPPayTypeTableViewCell class])];
    
    //改变图片方向
    UIImage *image = [UIImage imageWithCGImage:self.backBtn.currentImage.CGImage scale:2.0 orientation:UIImageOrientationDown];
    [self.backBtn setImage:image forState:UIControlStateNormal];
}




- (IBAction)back:(id)sender {
    [self removeFromSuperview];
}


#pragma mark--

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    SPPayTypeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SPPayTypeTableViewCell class])];
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    !self.finishBlock?:self.finishBlock();
    [self removeFromSuperview];
}

@end
